package com.zadtek.shopmall.fragments;

import android.content.Context;
import android.content.Intent;
import android.content.Loader;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.youth.banner.Banner;
import com.youth.banner.listener.OnBannerListener;
import com.youth.banner.loader.ImageLoader;
import com.zadtek.shopmall.App;
import com.zadtek.shopmall.R;
import com.zadtek.shopmall.activities.ProductDetailActivity;
import com.zadtek.shopmall.activities.ShopCartActivity;
import com.zadtek.shopmall.base.AbsFragment;
import com.zadtek.shopmall.bean.HomeBaseBean;
import com.zadtek.shopmall.bean.JsonBean;
import com.zadtek.shopmall.bean.ProductDetailItem;
import com.zadtek.shopmall.net.BaseObserver;
import com.zadtek.shopmall.net.BaseResponse;
import com.zadtek.shopmall.net.NetTool;
import com.zadtek.shopmall.other.Const;
import com.zadtek.shopmall.other.LocationManger;
import com.zadtek.shopmall.utils.GetJsonDataUtil;
import com.zadtek.shopmall.utils.ToastUtil;
import com.zadtek.shopmall.view.DrawableTextView;
import com.zadtek.shopmall.view.dialog.BaseNiceDialog;
import com.zadtek.shopmall.view.dialog.NiceDialog;
import com.zadtek.shopmall.view.dialog.ViewConvertListener;
import com.zadtek.shopmall.view.dialog.ViewHolder;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import q.rorbin.badgeview.QBadgeView;

/**
 * Created by Zackv on 2018/4/16.
 */

public class ProductDetailFragment extends AbsFragment implements View.OnClickListener {
    private Banner banner;
    private TextView tvSelf;
    private TextView tvProductTitle;
    private TextView tvProductPrice;
    private TextView tvProductSales;
    private TextView tvProductOldPrice;
    private TextView tvProductNumber;
    private TextView tvProductStorge;
    private TextView tvAddress;
    private TextView tvDeliverCost;
    private TextView tvChooseDesc;
    private TextView tvPercentage;
    private TextView tvEvaluationNum;
    private RelativeLayout rlShop;
    private ImageView ivShopImg;
    private TextView tvShopName;
    private TextView tvShopLike;
    private LinearLayout llShopDetail;
    private TextView tvProductMark;
    private TextView tvProductText;
    private TextView tvServiceMark;
    private TextView tvServiceText;
    private TextView tvTimeMark;
    private TextView tvTimeText;
    private DrawableTextView tvConnnet;
    private DrawableTextView tvEnterShop;
    private LinearLayout llAdvice;
    private LinearLayout llAdviceContainer;
    private DrawableTextView tvSelfConnect;
    private LinearLayout llService;
    private ImageView ivService;
    private LinearLayout llCollect;
    private ImageView ivCollect;
    private LinearLayout llShopcart;
    private ImageView ivShopcart;
    private LinearLayout llShop;
    private ImageView ivShop;
    private TextView tvAddToCart;
    private QBadgeView badgeView;

    private ProductDetailItem productDetailItem;


    private ArrayList<JsonBean> options1Items = new ArrayList<>();
    private ArrayList<ArrayList<String>> options2Items = new ArrayList<>();
    private ArrayList<ArrayList<ArrayList<String>>> options3Items = new ArrayList<>();
    private LinearLayout llEvaluation;
    private NiceDialog retryDialog;

    private void initView() {
        banner = (Banner)findViewById( R.id.banner );
        tvSelf = (TextView)findViewById( R.id.tv_self );
        tvProductTitle = (TextView)findViewById( R.id.tv_product_title );
        tvProductPrice = (TextView)findViewById( R.id.tv_product_price );
        tvProductSales = (TextView)findViewById( R.id.tv_product_sales );
        tvProductOldPrice = (TextView)findViewById( R.id.tv_product_old_price );
        tvProductNumber = (TextView)findViewById( R.id.tv_product_number );
        tvProductStorge = (TextView)findViewById( R.id.tv_product_storge );
        tvAddress = (TextView)findViewById( R.id.tv_address );
        tvDeliverCost = (TextView)findViewById( R.id.tv_deliver_cost );
        tvChooseDesc = (TextView)findViewById( R.id.tv_choose_desc );
        tvPercentage = (TextView)findViewById( R.id.tv_percentage );
        tvEvaluationNum = (TextView)findViewById( R.id.tv_evaluation_num );
        rlShop = (RelativeLayout)findViewById( R.id.rl_shop );
        ivShopImg = (ImageView)findViewById( R.id.iv_shop_img );
        tvShopName = (TextView)findViewById( R.id.tv_shop_name );
        tvShopLike = (TextView)findViewById( R.id.tv_shop_like );
        llShopDetail = (LinearLayout)findViewById( R.id.ll_shop_detail );
        tvProductMark = (TextView)findViewById( R.id.tv_product_mark );
        tvProductText = (TextView)findViewById( R.id.tv_product_text );
        tvServiceMark = (TextView)findViewById( R.id.tv_service_mark );
        tvServiceText = (TextView)findViewById( R.id.tv_service_text );
        tvTimeMark = (TextView)findViewById( R.id.tv_time_mark );
        tvTimeText = (TextView)findViewById( R.id.tv_time_text );
        tvConnnet = (DrawableTextView)findViewById( R.id.tv_connnet );
        tvEnterShop = (DrawableTextView)findViewById( R.id.tv_enter_shop );
        llAdvice = (LinearLayout)findViewById( R.id.ll_advice );
        llAdviceContainer = (LinearLayout)findViewById( R.id.ll_advice_container );
        tvSelfConnect = (DrawableTextView)findViewById( R.id.tv_self_connect );

        llService = (LinearLayout)findViewById( R.id.ll_service );
        ivService = (ImageView)findViewById( R.id.iv_service );
        llCollect = (LinearLayout)findViewById( R.id.ll_collect );
        ivCollect = (ImageView)findViewById( R.id.iv_collect );
        llShopcart = (LinearLayout)findViewById( R.id.ll_shopcart );
        ivShopcart = (ImageView)findViewById( R.id.iv_shopcart );
        llShop = (LinearLayout)findViewById( R.id.ll_shop );
        ivShop = (ImageView)findViewById( R.id.iv_shop );
        tvAddToCart = (TextView)findViewById( R.id.tv_add_to_cart );
        llEvaluation = (LinearLayout)findViewById(R.id.ll_evaluation);
        badgeView = new QBadgeView(mActivity);
        badgeView.setBadgeTextSize(10,true);
        badgeView.setShowShadow(false);
        badgeView.bindTarget(ivShopcart).setBadgeNumber(1);
    }

    @Override
    public int setView() {
        return R.layout.fragment_product_detail;
    }

    @Override
    public void initBasic(Bundle savedInstanceState) {
        initView();
        initLogic();
        requestData();
    }

    private void requestData() {
        initJsonData();
        Map<String, Object> params = NetTool.newParams();
        params.put("product_id",1);
        NetTool.getApi().getproductdetail(params)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new BaseObserver<BaseResponse<ProductDetailItem>>(this) {
                @Override
                public void onData(BaseResponse<ProductDetailItem> value) {
                    productDetailItem = value.getData();
                    updateView();
                }
            });


//        productDetailItem = new ProductDetailItem();
//        List<String> list = new LinkedList<>();
//        list.add("http://tc.zadtek.com/aaa/images/201603/goods_img/531_G_1457132885635.jpg");
//        list.add("http://tc.zadtek.com/aaa/images/201603/goods_img/531_G_1457132885635.jpg");
//        productDetailItem.setBannerList(list);
//        productDetailItem.setSelf(false);
//        productDetailItem.setProductTitle("申士（SNSIR）SN系 家庭影院套装 5.1组合功放音响 回音壁挂电视音箱 铝合金黑色");
//        productDetailItem.setProductPrice("￥1368.00");
//        productDetailItem.setProductSales("9折");
//        productDetailItem.setProductOldPrice("￥2000.00");
//        productDetailItem.setSaleNum(99);
//        productDetailItem.setStorageNum(999);
//        productDetailItem.setDeliverAddress("四川成都");
//        productDetailItem.setDeliverCost("￥0.00");
//        productDetailItem.setPercent(89);
//        productDetailItem.setEvaluateNum(66);
//        productDetailItem.setChooseNum(1);
//
//        productDetailItem.setShopName("5+ic_add");
//        productDetailItem.setShopLikes(999);
//        productDetailItem.setProductMark(5);
//        productDetailItem.setServiceMark(5);
//        productDetailItem.setTimeMark(5);
//
//        List<ProductDetailItem.TagItem> tagItems = new LinkedList<>();
//        ProductDetailItem.TagItem item = new ProductDetailItem.TagItem();
//        item.setTitle("颜色");
//        List<String> taglist = new LinkedList<>();
//        taglist.add("红色");
//        taglist.add("黄色");
//        taglist.add("黑色");
//        item.setTagList(taglist);
//        item.setChoose(-1);
//        tagItems.add(item);
//        ProductDetailItem.TagItem item2 = new ProductDetailItem.TagItem();
//        item2.setTitle("尺寸");
//        List<String> taglist2 = new LinkedList<>();
//        taglist2.add("大");
//        taglist2.add("中");
//        taglist2.add("小");
//        item2.setTagList(taglist2);
//        item2.setChoose(-1);
//        tagItems.add(item2);
//        productDetailItem.setTagItemList(tagItems);
//
//        BaseResponse<ProductDetailItem> baseResponse = new BaseResponse<>();
//        baseResponse.setCode(0);
//        baseResponse.setMessage("");
//        baseResponse.setData(productDetailItem);
//
//        Gson gson = new Gson();
//        String json = gson.toJson(baseResponse);

    }

    private void updateView() {
        banner.setImages(productDetailItem.getBannerList());
        banner.start();
        tvProductTitle.setText(productDetailItem.getProductTitle());
        tvProductPrice.setText(productDetailItem.getProductPrice());
        tvProductSales.setText(productDetailItem.getProductSales());
        tvProductOldPrice.setText(productDetailItem.getProductOldPrice());
        tvProductNumber.setText("销量 "+String.valueOf(productDetailItem.getSaleNum()));
        tvProductStorge.setText("库存 "+String.valueOf(productDetailItem.getStorageNum()));
        if(LocationManger.location!=null){
            tvAddress.setText(LocationManger.location.getAddress());
        }
        tvDeliverCost.setText(productDetailItem.getDeliverCost());
        tvPercentage.setText(String.valueOf(productDetailItem.getPercent())+"%");
        tvEvaluationNum.setText(String.valueOf(productDetailItem.getEvaluateNum())+"人评论");
        changeDesc();
        if(productDetailItem.getIsSelf() == 1){
            tvSelf.setVisibility(View.VISIBLE);
            rlShop.setVisibility(View.GONE);
            updateAdvice();
            llAdvice.setVisibility(View.VISIBLE);
            llShop.setVisibility(View.GONE);
        }else{
            tvSelf.setVisibility(View.GONE);
            rlShop.setVisibility(View.VISIBLE);
            llAdvice.setVisibility(View.GONE);
            llShop.setVisibility(View.VISIBLE);
            tvShopName.setText(productDetailItem.getShopName());
            tvShopLike.setText("已经有"+productDetailItem.getShopLikes()+"人关注");
            tvProductMark.setText(String.valueOf(productDetailItem.getProductMark()));
            tvServiceMark.setText(String.valueOf(productDetailItem.getServiceMark()));
            tvTimeMark.setText(String.valueOf(productDetailItem.getTimeMark()));

            tvProductText.setText("高");
            tvServiceText.setText("高");
            tvTimeText.setText("高");
        }
    }

    private void updateAdvice() {
        for(int i=0;i<productDetailItem.getAdviceProductList().size();i++){
            View v = getLayoutInflater().inflate(R.layout.product_item2,null);

            ImageView productImg = (ImageView) v.findViewById(R.id.product_img);
            TextView productTitle = (TextView) v.findViewById(R.id.product_title);
            TextView productPrice = (TextView) v.findViewById(R.id.product_price);

            productPrice.setText(productDetailItem.getAdviceProductList().get(i).getProductPrice());
            productTitle.setText(productDetailItem.getAdviceProductList().get(i).getProductTitle());
            Glide.with(mActivity).load(productDetailItem.getAdviceProductList().get(i).getProductImgUrl()).into(productImg);

            final int finalI = i;
            v.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    ToastUtil.showToast(finalI+"");
                    Const.jumpHandle(mActivity,productDetailItem.getAdviceProductList().get(finalI));
                }
            });
            v.setPadding(10,10,10,10);
            llAdviceContainer.addView(v);
        }
    }

    private void initLogic() {
        banner.setOnBannerListener(new OnBannerListener() {
            @Override
            public void OnBannerClick(int position) {
                ToastUtil.showToast("banner"+position);
            }
        });
        banner.setImageLoader(new GlideImageLoader());
        tvProductOldPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        tvAddress.setOnClickListener(this);
        tvChooseDesc.setOnClickListener(this);
        tvDeliverCost.setOnClickListener(this);
        tvEvaluationNum.setOnClickListener(this);
        llShop.setOnClickListener(this);
        tvConnnet.setOnClickListener(this);
        tvSelfConnect.setOnClickListener(this);
        tvEnterShop.setOnClickListener(this);


        llCollect.setOnClickListener(this);
        llService.setOnClickListener(this);
        llShop.setOnClickListener(this);
        llShopcart.setOnClickListener(this);
        tvAddToCart.setOnClickListener(this);
        llEvaluation.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.ll_evaluation:
                ((ProductDetailActivity)mActivity).setCurrentPage(2);
                break;
            case R.id.tv_address:
                showPickerView();
                break;
            case R.id.ll_shop_detail:
                shopJump();
                break;
            case R.id.tv_connnet:
                break;
            case R.id.tv_self_connect:
                serviceJump();
                break;
            case R.id.tv_enter_shop:
                shopJump();
                break;
            case R.id.tv_choose_desc:
                showChooseWindow();
                break;
            case R.id.ll_collect:
                collectRequest();
                break;
            case R.id.ll_service:
                serviceJump();
                break;
            case R.id.ll_shopcart:
                shopCartJump();
                break;
            case R.id.ll_shop:
                shopJump();
                break;
            case R.id.tv_add_to_cart:
                addToShopcartRequest();
                break;
        }
    }

    private void shopJump() {
        HomeBaseBean homeBaseBean = new HomeBaseBean();
        homeBaseBean.setType(Const.SHOP);
        homeBaseBean.setId(productDetailItem.getShopId());
        Const.jumpHandle(mActivity,homeBaseBean);
    }

    private void shopCartJump() {
        ToastUtil.showToast("跳转到购物车");
        startActivity(new Intent(mActivity, ShopCartActivity.class));
    }

    private void serviceJump() {
        final String target = "testpro2"; //消息接收者ID
        final String appkey = "23015524"; //消息接收者appKey
        if(App.mIMKit == null){
            ToastUtil.showToast("YMKit未初始化！");
            return;
        }
        Intent intent = App.mIMKit.getChattingActivityIntent(target, appkey);
        startActivity(intent);
    }

    private void collectRequest() {
        ToastUtil.showToast("收藏请求");
    }

    private void showChooseWindow() {
        final NiceDialog tempDialog = NiceDialog.init();

        tempDialog.setLayoutId(R.layout.choose_window)
                .setConvertListener(new ViewConvertListener() {
                    @Override
                    public void convertView(final ViewHolder holder, final BaseNiceDialog dialog) {
                        LinearLayout linearLayout = (LinearLayout) holder.getView(R.id.ll_choose_container);
                        final List<ProductDetailItem.TagItem> tagItems = productDetailItem.getTagItemList();
                        for(int i=0;i<tagItems.size();i++){
                            final ProductDetailItem.TagItem item = tagItems.get(i);
                            View v = getLayoutInflater().inflate(R.layout.choose_item,null);
                            TextView title = (TextView)v.findViewById(R.id.tv_choose_title);
                            final TagFlowLayout tagContainer = (TagFlowLayout)v.findViewById(R.id.fl_tag);
                            title.setText(item.getTitle());
                            final TagAdapter tagAdapter =new TagAdapter<String>(item.getTagList()) {
                                @Override
                                public View getView(FlowLayout parent, int position, String s) {
                                    TextView tv = (TextView) getLayoutInflater().inflate(R.layout.tv,null);
                                    tv.setText(s);
                                    if(item.getChoose() == position){
                                        tv.setTextColor(getResources().getColor(R.color.color_red));
                                        tv.setBackground(getResources().getDrawable(R.drawable.tag_bg_red));
                                    }else{
                                        tv.setTextColor(getResources().getColor(R.color.color_grey5nd));
                                        tv.setBackground(getResources().getDrawable(R.drawable.tag_bg_grey));
                                    }
                                    return tv;
                                }
                            };
                            tagContainer.setAdapter(tagAdapter);
                            final int finalI = i;
                            tagContainer.setOnTagClickListener(new TagFlowLayout.OnTagClickListener() {
                                @Override
                                public boolean onTagClick(View view, int position, FlowLayout parent) {
                                    ToastUtil.showToast("click:"+ finalI +"position"+position);
                                    item.setChoose(position);
                                    tagAdapter.notifyDataChanged();
                                    changeDesc();
                                    return true;
                                }
                            });
                            linearLayout.addView(v);
                        }

                        int nowNumber = productDetailItem.getChooseNum();
                        holder.setText(R.id.tv_count,String.valueOf(nowNumber));
                        holder.setOnClickListener(R.id.iv_close_all, new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                tempDialog.dismiss();
                            }
                        });
                        holder.setOnClickListener(R.id.btn_add, new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                int nowNumber = productDetailItem.getChooseNum();
                                nowNumber++;
                                holder.setText(R.id.tv_count,String.valueOf(nowNumber));
                                productDetailItem.setChooseNum(nowNumber);
                                changeDesc();
                            }
                        });
                        holder.setOnClickListener(R.id.btn_remove, new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                int nowNumber = productDetailItem.getChooseNum();
                                nowNumber--;
                                if(nowNumber>0){
                                    holder.setText(R.id.tv_count,String.valueOf(nowNumber));
                                    productDetailItem.setChooseNum(nowNumber);
                                    changeDesc();
                                }
                            }
                        });
                        holder.setOnClickListener(R.id.tv_btn_buy_now, new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                tempDialog.dismiss();
                                addToShopcartRequest();
                            }
                        });
                        holder.setOnClickListener(R.id.tv_btn_confirm, new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                tempDialog.dismiss();
                            }
                        });
                    }
                })
                .setShowBottom(true)
                .show(getFragmentManager());
    }

    private void changeDesc() {
        String s = "";
        List<ProductDetailItem.TagItem> list = productDetailItem.getTagItemList();
        for(int i=0;i<list.size();i++){
            ProductDetailItem.TagItem item = list.get(i);
            if(item.getChoose() != -1 ){
                s= s + item.getTagList().get(item.getChoose())+" ";
            }
        }
        s = s + productDetailItem.getChooseNum()+"个";
        tvChooseDesc.setText(s);

    }

    private void addToShopcartRequest() {
        ToastUtil.showToast("addToShopcartRequest");
    }

    public class GlideImageLoader extends ImageLoader {
        @Override
        public void displayImage(Context context, Object path, ImageView imageView) {
            Glide.with(context).load(path).into(imageView);
        }
    }


    private void initJsonData() {//解析数据
        /**
         * 注意：assets 目录下的Json文件仅供参考，实际使用可自行替换文件
         * 关键逻辑在于循环体
         *
         * */
        String JsonData = new GetJsonDataUtil().getJson(mActivity, "province.json");//获取assets目录下的json文件数据

        ArrayList<JsonBean> jsonBean = parseData(JsonData);//用Gson 转成实体

        /**
         * 添加省份数据
         *
         * 注意：如果是添加的JavaBean实体，则实体类需要实现 IPickerViewData 接口，
         * PickerView会通过getPickerViewText方法获取字符串显示出来。
         */
        options1Items = jsonBean;

        for (int i = 0; i < jsonBean.size(); i++) {//遍历省份
            ArrayList<String> CityList = new ArrayList<>();//该省的城市列表（第二级）
            ArrayList<ArrayList<String>> Province_AreaList = new ArrayList<>();//该省的所有地区列表（第三极）

            for (int c = 0; c < jsonBean.get(i).getCityList().size(); c++) {//遍历该省份的所有城市
                String CityName = jsonBean.get(i).getCityList().get(c).getName();
                CityList.add(CityName);//添加城市
                ArrayList<String> City_AreaList = new ArrayList<>();//该城市的所有地区列表

                //如果无地区数据，建议添加空字符串，防止数据为null 导致三个选项长度不匹配造成崩溃
                if (jsonBean.get(i).getCityList().get(c).getArea() == null
                        || jsonBean.get(i).getCityList().get(c).getArea().size() == 0) {
                    City_AreaList.add("");
                } else {
                    City_AreaList.addAll(jsonBean.get(i).getCityList().get(c).getArea());
                }
                Province_AreaList.add(City_AreaList);//添加该省所有地区数据
            }

            /**
             * 添加城市数据
             */
            options2Items.add(CityList);

            /**
             * 添加地区数据
             */
            options3Items.add(Province_AreaList);
        }

    }
    private void showPickerView() {// 弹出选择器

        OptionsPickerView pvOptions = new OptionsPickerBuilder(mActivity, new OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int options2, int options3, View v) {
                //返回的分别是三个级别的选中位置
                String tx = options1Items.get(options1).getPickerViewText() +
                        options2Items.get(options1).get(options2) +
                        options3Items.get(options1).get(options2).get(options3);

                Toast.makeText(mActivity, tx, Toast.LENGTH_SHORT).show();
                tvAddress.setText(tx);
            }
        })

                .setTitleText("城市选择")
                .setDividerColor(Color.BLACK)
                .setTextColorCenter(Color.BLACK) //设置选中项文字颜色
                .setContentTextSize(20)
                .build();

        /*pvOptions.setPicker(options1Items);//一级选择器
        pvOptions.setPicker(options1Items, options2Items);//二级选择器*/
        pvOptions.setPicker(options1Items, options2Items, options3Items);//三级选择器
        pvOptions.show();
    }

    public ArrayList<JsonBean> parseData(String result) {//Gson 解析
        ArrayList<JsonBean> detail = new ArrayList<>();
        try {
            JSONArray data = new JSONArray(result);
            Gson gson = new Gson();
            for (int i = 0; i < data.length(); i++) {
                JsonBean entity = gson.fromJson(data.optJSONObject(i).toString(), JsonBean.class);
                detail.add(entity);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return detail;
    }

    @Override
    public void showRetryView() {
        retryDialog = NiceDialog.init();
                retryDialog.setLayoutId(R.layout.retry_view)
                .setConvertListener(new ViewConvertListener() {
                    @Override
                    protected void convertView(ViewHolder var1, BaseNiceDialog var2) {
                        var1.getConvertView().setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                requestData();
                                retryDialog.dismiss();
                                retryDialog = null;
                            }
                        });
                    }
                }).setWidth(100).setHeight(100).setDimAmount(0)
                .show(getFragmentManager());
    }
}
